<script>
	import loin from "@/components/loin.vue"
		import share from "./utils/share.js";
	export default {
		onLaunch: function() {
			const query = new URLSearchParams(window.location.search);
			  const code = query.get('code');
			  const state = query.get('state');
			
			  if (code && state) {
			    uni.navigateTo({
			      url: `/pages/courseDetails/orderPayment?code=${code}&id=${state}`
			    });
			  }
			
			  // 添加网络状态检测
			  uni.getNetworkType({
			      success: function (res) {
			          if (res.networkType === 'none') {
			              uni.showToast({
			                  title: '网络不可用，请检查网络设置',
			                  icon: 'none'
			              });
			          }
			      }
			  });
			
			  // 监听网络状态变化
			  uni.onNetworkStatusChange(function (res) {
			      if (res.isConnected) {
			          uni.showToast({
			              title: '网络已连接',
			              icon: 'success'
			          });
			          // 在网络连接后刷新页面
			          uni.reLaunch({
			              url: '/pages/index/index'
			          });
			      }
			  });
		},
		methods: {
			onShareAppMessage:share.onShareAppMessage,
			onShareAppMessage:share.onShareTimeline,
		    registerShareEvent: function() {
		      // 注册全局分享事件
		    },
		    unregisterShareEvent: function() {
		    }
		  }
	}
</script>
<style>
	@import "./utils/bu-css/public.css";
</style>